hisilicon-osdrv-hi3516cv200: add GC2023 MIPI sensor variant - #2248
Conversation
PR Summary by QodoAdd GC2023 MIPI (CSI-2) sensor variant for Hi3516CV200
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can ask Qodo to dismiss a finding you disagree with, with your reason on record |
flyrouter
left a comment
There was a problem hiding this comment.
Thanks.
It looks like an interesting proposal for improvement.
widgetii
left a comment
There was a problem hiding this comment.
Thanks — this is unusually well-evidenced work, and the writeup in #2243 is genuinely useful material. I reviewed both halves separately, because they have very different risk and value profiles.
The load_hisilicon half: correct, and I want it
No regression risk, verified rather than assumed:
casematching is exact-glob and the DVPgc2023arm comes first, so no existingsensorvalue changes behaviour.- Kernel side:
open_sys_configfor cv200 carries its own duplicate pinmux table (kernel/sys_config/hi3516cv200/sys_config.c) and falls through toprintk("sensor_type '%s' is error!!!")for names it does not know — non-fatal, and the script'sdevmemwrites run afterwards and win.gc2023,ov2735and several others already hit that same branch today. - The vendor
hi3518e_sys.kotakessensoras a barecharpwith no name table, so an unknown value is inert there too. - Affected defconfigs are
hi3516cv200_lite,hi3518ev200_lite,hi3518ev200_ultimate,hi3518ev201_lite. The new.iniis installed unconditionally by the*.iniglob in the.mk: ~10 KB raw, ~3 KB compressed. Irrelevant even on the tight lite boards.
One asymmetry worth flagging: the OV2710 precedent you follow (#2038) updated both sys_config.c in openhisilicon and load_hisilicon. This PR only does the latter. That is harmless, but it means dmesg now gains a sensor_type 'gc2023_mipi' is error!!! line, which looks alarming to anyone reading a boot log. Adding the arm to sys_config.c as well would keep the two tables in sync and keep the log clean.
The .ini half: one real objection, and it is the header
From your own table in #2243, on the same unit with the same MIPI ini and the same fixed pinmux:
| library | frames |
|---|---|
vendor MIPI libsns_gc2023.so |
yes |
vendor DVP libsns_gc2023_dvp.so |
none (VENC timeout) |
OpenIPC libsns_gc2023.so |
none (VENC timeout) |
DllFile in this file points at row three. So anyone who follows this file's own instructions gets a VENC timeout. That is fine — it is a platform-side template, and it is useful to someone who supplies their own MIPI libsns and edits one line — but the header currently says "Verified on a VStarcam Hi3518EV200 board with the GC2023 wired to MIPI", which is not true of this file with this DllFile. Verification was done with a library that is not the one named here. That comment will cost somebody a day.
Before merge I would like just the header corrected (suggestion inline). The frame-rate and Bayer notes are questions, not blockers.
On "what is the point if the camera still does not work"
Answering it here since it will come up. The platform half is a prerequisite that no library can work without — without it the MIPI PHY is dead and the sensor is unreachable on these boards regardless of what userspace you throw at it — and it costs nothing. The .ini is scaffolding that the open driver your init table in #2243 makes possible will plug straight into. Both are worth having, as long as the file is honest about what does and does not work today. That is the whole of my ask.
|
All asks addressed, and the naming experiment produced a more interesting answer than either of us guessed. Header (b168796): your text taken essentially verbatim. The file now leads with the NOTE that the OpenIPC-shipped The naming experiment, run on the unit: The search key does not come from the sys_config.c asymmetry: fixed for real rather than flagged — OpenIPC/openhisilicon#207 adds the Isp_FrameRate 25 vs 30: a leftover of the clone — but a leftover the verification ran with. The working vendor-libsns session used this file with 25 in place, while the recovered init table is And thank you for the closing paragraph — "prerequisite plus scaffolding, as long as the file is honest" is exactly the framing I will steal for the next one of these. |
b168796 to
7b88d55
Compare
Mirror of the ov2710_mipi arm: I2C0 pinmux plus 24MHz sensor clock, with the parallel VI pads left alone so the MIPI PHY keeps the pins. Companion to OpenIPC/firmware#2248, which adds the gc2023_mipi identity to load_hisilicon and a gc2023_mipi_1080p.ini; without this arm a gc2023_mipi boot logs "sensor_type 'gc2023_mipi' is error!!!" before the script's devmem writes apply the same values. The register writes themselves are hardware-verified: they are the ones the load_hisilicon arm issues via devmem on a VStarcam Hi3518EV200 (see OpenIPC/firmware#2243 for the bring-up record).
Mirror of the ov2710_mipi arm: I2C0 pinmux plus 24MHz sensor clock, with the parallel VI pads left alone so the MIPI PHY keeps the pins. Companion to OpenIPC/firmware#2248, which adds the gc2023_mipi identity to load_hisilicon and a gc2023_mipi_1080p.ini; without this arm a gc2023_mipi boot logs "sensor_type 'gc2023_mipi' is error!!!" before the script's devmem writes apply the same values. The register writes themselves are hardware-verified: they are the ones the load_hisilicon arm issues via devmem on a VStarcam Hi3518EV200 (see OpenIPC/firmware#2243 for the bring-up record).
Some GC2023 boards wire the sensor to the MIPI CSI-2 interface, not DVP - e.g. VStarcam Hi3518EV200 cameras (2-lane RAW10). For those boards the existing gc2023 entry in load_hisilicon is fatal: it muxes the parallel VI pads (0x200f007c..0x200f0094) to VI_DATA/VI_VS/VI_HS, which disables the MIPI PHY. The tell is /proc/umap/vi showing IntCnt=0 with TmgErr=0 and ccErrN=0 - VI receives no VSYNC at all, while bad ini timings would at least raise the error counters. Following the OV2710 precedent (OpenIPC#2035/OpenIPC#2038), add a gc2023_mipi sensor identity that only muxes I2C0 and sets the 24MHz sensor clock, plus a gc2023_mipi_1080p.ini cloned from ov2735_mipi_1080p.ini (same SoC, same 2-lane RAW10 MIPI geometry) with the sensor identity swapped and Isp_Bayer corrected to 0 (RGGB - GC2023 is SRGGB10; the tell for getting this wrong is red and blue swapping). The plain gc2023 DVP entry is left untouched. Verified on a VStarcam Hi3518EV200: with this identity and ini, VI IntCnt climbs and majestic delivers 1920x1080 at the sensor's native timing. Note the shipped closed-source libsns_gc2023.so did not produce frames on that unit (VENC timeout; it appears to program the sensor for DVP output) - the working setup used the vendor's MIPI libsns. The platform side this commit fixes is required either way, and the sensor init details recovered from the vendor lib are documented in the matching issue for a future open-source driver.
Review follow-up. The ini header claimed 'verified on a VStarcam Hi3518EV200' while its own DllFile points at the OpenIPC-shipped libsns_gc2023.so, which produces no frames on a MIPI-wired board (VENC timeout - it appears to program the sensor for DVP output). The MIPI geometry was in fact validated with the vendor's MIPI library. Say so in the header, so nobody selects this preset and burns a day chasing optics; point at issue OpenIPC#2243 for the full bring-up record. Also note next to Isp_FrameRate that 25 is the value the verification ran with while the vendor init table is a 1080p30 one, and fix the load_hisilicon comment that pointed at the plain gc2023 arm as 'below' when it sits in the first case arm above.
Some GC2023 boards wire the sensor to MIPI CSI-2, not DVP — e.g. VStarcam Hi3518EV200 pan/tilt cameras (2-lane RAW10). For those boards the existing
gc2023entry inload_hisiliconis fatal: it muxes the parallel VI pads (0x200f007c..0x200f0094), which disables the MIPI PHY. The tell is/proc/umap/vishowingIntCnt=0withTmgErr=0andccErrN=0— VI receives no VSYNC at all, while bad ini timings would at least raise the error counters.Following the OV2710 precedent (#2035/#2038), this adds:
gc2023_mipisensor identity that only muxes I2C0 and sets the 24 MHz sensor clock — the plaingc2023DVP entry is untouched;gc2023_mipi_1080p.ini, cloned fromov2735_mipi_1080p.ini(same SoC, same 2-lane RAW10 MIPI geometry) with the sensor identity swapped andIsp_Bayercorrected to 0 (RGGB — GC2023 is SRGGB10; the symptom of getting this wrong is red and blue swapping).Verified on a VStarcam Hi3518EV200: with this identity and ini, VI
IntCntclimbs and majestic delivers 1920×1080 at the sensor's native timing.One honest caveat, detailed in #2243: the shipped closed-source
libsns_gc2023.sodid not produce frames on the tested unit (VENC timeout; it appears to program the sensor for DVP output) — the working setup used the vendor's MIPI libsns plus an init-table replay. The platform side fixed here is required either way, and #2243 carries the full recovered init table (123 writes, including the digital-gain0xb1trap) toward an open-source driver.